{% extends "pkg/pkg_base.html" %}

{% block content %}
    <div class="container-fluid" style="margin-top: 20px">
        {# 游戏搜索栏 #}
        <div class="row-fluid">
            <form class="form-horizontal" role="form">
                <div class="form-group">
                    <label for="game_template"
                           class="col-lg-1 control-label">游戏</label>
                    <div class="col-lg-11">
                        <select id="game_template"
                                class="selectpicker show-tick form-control"
                                data-live-search="true"
                                onchange="get_game_info(this)">
                            <option value="">选择游戏</option>
                            {% for k,v in games.items %}
                                <option value="{{ k }}"
                                        {% ifequal k client_id %}selected{% endifequal %}>{{ v }}</option>
                            {% endfor %}
                        </select>
                    </div>
                </div>
            </form>
        </div>
        {# 游戏基本信息 #}
        <div id="case_content" style="">
            <form class="form-horizontal">
                <fieldset disabled="disabled" id="game_detail">
                    {# 用例基本信息 #}
                    <div class="case_basic">
                        <h4>游戏基本信息:</h4>
                        <div class="form-group">
                            <div class="col-sm-3 hidden">
                                <input type="text" class="form-control edit_log"
                                       id="log_id"
                                       name="log_id"
                                       value="{{ game_log.id }}">
                                <input type="text" class="form-control edit_log"
                                       id="game_name"
                                       name="game_name"
                                       value="{{ game.name }}">
                            </div>
                            <table class="table table-bordered table-condensed"
                                   style="background-color: #d9edf7;">
                                <tbody>
                                <tr>
                                    <td rowspan="2" id="game_info_ios"
                                        style="text-align: center;vertical-align: middle;width: 150px">
                                        游戏包信息
                                    </td>
                                    <td colspan="3" hidden></td>
                                </tr>
                                <tr>
                                    <td><label for="client_id"
                                               class="control-label">client_id</label>

                                        <div class="">
                                            <input type="text"
                                                   class="form-control"
                                                   id="client"
                                                   name="client"
                                                   value="{{ game.client_id }}"
                                                   readonly>
                                        </div>
                                    </td>
                                    <td class="hidden"><label for="game_type"
                                                              class="control-label">type</label>

                                        <div class="">
                                            <input type="text"
                                                   class="form-control"
                                                   id="game_type"
                                                   name="game_type"
                                                   value="{{ game.game_type }}"
                                                   readonly>
                                        </div>
                                    </td>
                                    <td><label for="appver"
                                               class="control-label ">versionName</label>

                                        <div>
                                            <input type="text"
                                                   class="form-control edit_log case_info"
                                                   id="appver"
                                                   name="appver"
                                                   value="{{ game_log.appver }}"
                                                   required>
                                        </div>
                                    </td>
                                    <td>
                                        <label for="recharge"
                                               class="control-label">recharge</label>
                                        <div class="edit_log">
                                            <select id="recharge"
                                                    name="recharge"
                                                    class="form-control"
                                                    onchange="change_recharge();">
                                                <option value=""></option>
                                                <option value="0">非充值包</option>
                                                <option value="1">充值包</option>
                                                <option value="2">动态充值包</option>
                                            </select>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td rowspan="2" id="sdk_info_ios"
                                        style="text-align: center;vertical-align: middle;">
                                        SDK信息
                                    </td>
                                    <td colspan="3" hidden></td>
                                </tr>

                                <tr>
                                    <td><label for="sy_sdk"
                                               class="control-label">sdkver</label>

                                        <div class="">
                                            <input type="text"
                                                   class="form-control edit_log case_info"
                                                   id="sy_sdk" name="sy_sdk"
                                                   value="{{ game_log.sy_sdk }}">
                                        </div>
                                    </td>
                                    <td><label for="pt_type"
                                               class="control-label">plat</label>
                                        <div class="edit_log">
                                            <select id="pt_type" name="pt_type"
                                                    class="form-control"
                                                    onchange="change_pt_type();">
                                                <option value=""></option>
                                                <option value="jm">jm</option>
                                                <option value="sy">sy</option>
                                            </select>
                                        </div>
                                    </td>
                                    <td>
                                        <label for="project_id"
                                               class="control-label yd_type"
                                               style="">project_id</label>

                                        <div class="yd_type" style="">
                                            <input type="text"
                                                   class="form-control edit_log case_info"
                                                   id="project_id"
                                                   name="project_id"
                                                   value="{{ case_info.ext.project_id }}">
                                        </div>
                                    </td>
                                </tr>

                                <tr>
                                    <td style="text-align: center;vertical-align: middle;">
                                        测试信息
                                    </td>
                                    <td><label for="device_id"
                                               class="control-label">device_id</label>

                                        <div class="">
                                            <input type="text"
                                                   class="form-control edit_log case_info"
                                                   id="device_id"
                                                   name="device_id"
                                                   value="{{ game_log.device_id }}">
                                        </div>
                                    </td>
                                    <td>
                                        <label for="modify_date"
                                               class="control-label">tester</label>

                                        <div class="">
                                            <input type="text"
                                                   class="form-control case_info"
                                                   id="modify_date"
                                                   name="modify_date"
                                                   value="{{ game_log.creator }} | {{ game_log.modify_date|date:'Y-m-d H:i:s' }}"
                                                   readonly>
                                        </div>
                                    </td>
                                    <td>
                                        <label for="result"
                                               class="control-label">result</label>
                                        <div class="edit_log">
                                            <select id="result" name="result"
                                                    class="form-control">
                                                <option value=""></option>
                                                <option value="1">通过</option>
                                                <option value="0">不通过
                                                </option>
                                            </select>
                                        </div>
                                    </td>
                                </tr>

                                </tbody>
                            </table>
                        </div>
                    </div>
                    <h4 style="margin-top: -20px">用例检查点:</h4>
                    <div class="form-group" id="case_basic">
                        <table class="table table-bordered table-condensed"
                               style="background-color: #d9edf7;">
                            <thead>
                            <tr class="success">
                                <th style="width: 150px">项目</th>
                                <th>子项目</th>
                                <th>接入列表</th>
                                <th class="common_type">大陆(4399sy)日志</th>
                                <th class="yd_type">源点日志</th>
                                <th>备注</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td rowspan="25"
                                    style="text-align: center;vertical-align: middle">
                                    平台SDK接入
                                </td>
                                <td colspan="4" class="hidden"></td>
                            </tr>
                            <tr>
                                <td rowspan="10" class="disabled"
                                    id="client_log_ios"
                                    style="text-align: center;vertical-align: middle">
                                    <a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="client">客户端埋点数据</a>
                                </td>
                                <td colspan="5" class="hidden"></td>
                            </tr>
                            <tr>
                                <td>
                                    <a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="open_game" class="muted">
                                        打开游戏日志 </a>
                                </td>
                                <td class="common_type">
                                    <select id="open_game_dl"
                                            name="open_game_dl"
                                            class="form-control text-muted"
                                            required>
                                        <option value=""></option>
                                        <option value="1">通过</option>
                                        <option value="0">不通过</option>
                                        <option value="3">忽略</option>
                                        <option value="2">暂不接入</option>
                                    </select>
                                </td>
                                <td class="yd_type">
                                    <select id="open_game_yd"
                                            name="open_game_yd"
                                            class="form-control text-muted"
                                            required>
                                        <option value=""></option>
                                        <option value="1">通过</option>
                                        <option value="0">不通过</option>
                                        <option value="3">忽略</option>
                                        <option value="2">暂不接入</option>

                                    </select>
                                </td>
                                <td class="ext">
                                    <input type="text"
                                           class="form-control edit_log ext"
                                           id="open_game_ext"
                                           name="open_game_ext"
                                           value="{{ case_info.open_game.ext }}">
                                </td>
                            </tr>
                            <tr class="common_type">
                                <td><a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="before_login">
                                    登录界面前日志</a></td>
                                <td class="common_type"><select
                                        id="before_login_dl"
                                        name="before_login_dl"
                                        class="form-control">
                                    <option value=""></option>
                                    <option value="1">通过</option>
                                    <option value="0">不通过</option>
                                    <option value="3">忽略</option>
                                    <option value="2">暂不接入</option>
                                </select></td>
                                <td  class="yd_type ">
                                    ——
                                </td>
                                <td class="ext"><input type="text"
                                                                    class="form-control edit_log ext"
                                                                    id="before_login_ext"
                                                                    name="before_login_ext"
                                                                    value="{{ case_info.before_login.ext }}">
                                </td>
                            </tr>
                            <tr class="yd_type">
                                <td><a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="regist">注册日志
                                </a>
                                </td>
                                <td class="common_type">
                                    ——
                                </td>
                                <td>
                                    <select id="regist_yd" name="regist_yd"
                                            class="form-control">
                                        <option value=""></option>
                                        <option value="1">通过</option>
                                        <option value="0">不通过</option>
                                        <option value="3">忽略</option>
                                        <option value="2">暂不接入</option>
                                    </select>
                                </td>


                                <td class="ext"><input type="text"
                                                                    class="form-control edit_log ext"
                                                                    id="regist_yd_ext"
                                                                    name="regist_yd_ext"
                                                                    value="{{ case_info.regist_yd.ext }}">
                                </td>
                            </tr>
                            <tr class="yd_type">
                                <td>
                                    <a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="after_login">
                                        平台登录日志</a></td>
                                <td  class="common_type ">
                                    ——
                                </td>
                                <td>
                                    <select id="login_yd"
                                            name="login_yd"
                                            class="form-control">
                                        <option value=""></option>
                                        <option value="1">通过</option>
                                        <option value="0">不通过</option>
                                        <option value="3">忽略</option>
                                        <option value="2">暂不接入</option>

                                    </select></td>

                                <td class="ext"><input type="text"
                                                                    class="form-control edit_log ext"
                                                                    id="login_ext"
                                                                    name="login_ext"
                                                                    value="{{ case_info.login.ext }}">
                                </td>
                            </tr>
                            <tr>
                                <td><a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="select_server">
                                    选服日志</a></td>
                                <td class="common_type"><select
                                        id="select_server_dl"
                                        name="select_server_dl"
                                        class="form-control">
                                    <option value=""></option>
                                    <option value="1">通过</option>
                                    <option value="0">不通过</option>
                                    <option value="3">忽略</option>
                                    <option value="2">暂不接入</option>

                                </select></td>
                                <td class="yd_type">
                                    <select id="select_server_yd"
                                            name="select_server_yd"
                                            class="form-control">
                                        <option value=""></option>
                                        <option value="1">通过</option>
                                        <option value="0">不通过</option>
                                        <option value="3">忽略</option>
                                        <option value="2">暂不接入</option>

                                    </select>
                                </td>
                                <td class="ext"><input type="text"
                                                                    class="form-control edit_log ext"
                                                                    id="select_server_ext"
                                                                    name="select_server_ext"
                                                                    value="{{ case_info.select_server.ext }}">
                                </td>
                            </tr>
                            <tr>
                                <td><a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="create_role">
                                    创角日志</a></td>


                                <td class="common_type"><select
                                        id="create_role_dl"
                                        name="create_role_dl"
                                        class="form-control">
                                    <option value=""></option>
                                    <option value="1">通过</option>
                                    <option value="0">不通过</option>
                                    <option value="3">忽略</option>
                                    <option value="2">暂不接入</option>

                                </select></td>
                                <td class="yd_type"><select id="create_role_yd"
                                                            name="create_role_yd"
                                                            class="form-control">
                                    <option value=""></option>
                                    <option value="1">通过</option>
                                    <option value="0">不通过</option>
                                    <option value="3">忽略</option>
                                    <option value="2">暂不接入</option>

                                </select></td>

                                <td class="ext"><input type="text"
                                                                    class="form-control edit_log ext"
                                                                    id="create_role_ext"
                                                                    name="create_role_ext"
                                                                    value="{{ case_info.create_role.ext }}">
                                </td>
                            </tr>

                            <tr class="common_type">
                                <td><a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="level">
                                    等级日志</a></td>
                                <td><select id="level_dl" name="level_dl"
                                            class="form-control">
                                    <option value=""></option>
                                    <option value="1">通过</option>
                                    <option value="0">不通过</option>
                                    <option value="3">忽略</option>
                                    <option value="2">暂不接入</option>

                                </select></td>
                                <td  class="yd_type ">
                                    ——
                                </td>

                                <td class="ext"><input type="text"
                                                                    class="form-control edit_log ext"
                                                                    id="level_ext"
                                                                    name="level_ext"
                                                                    value="{{ case_info.level.ext }}">
                                </td>
                            </tr>
                            <tr class="common_type">
                                <td><a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="gift">
                                    礼包激活日志</a></td>
                                <td><select id="gift_dl" name="gift_dl"
                                            class="form-control">
                                    <option value=""></option>
                                    <option value="1">通过</option>
                                    <option value="0">不通过</option>
                                    <option value="3">忽略</option>
                                    <option value="2">暂不接入</option>

                                </select></td>
                                <td  class="yd_type ">
                                    ——
                                </td>

                                <td class="ext"><input type="text"
                                                                    class="form-control edit_log ext"
                                                                    id="gift_ext"
                                                                    name="gift_ext"
                                                                    value="{{ case_info.gift.ext }}">
                                </td>
                            </tr>
                            <tr class="yd_type">
                                <td>
                                    <a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="event_ext">
                                        自定义事件</a>
                                </td>
                                <td  class="common_type ">
                                    ——
                                </td>

                                <td>
                                    <select id="define_yd" name="define_yd"
                                            class="form-control">
                                        <option value=""></option>
                                        <option value="1">通过</option>
                                        <option value="0">不通过</option>
                                        <option value="3">忽略</option>
                                        <option value="2">暂不接入</option>
                                    </select>
                                </td>


                                <td class="ext">
                                    <input type="text"
                                           class="form-control edit_log ext"
                                           id="define_ext"
                                           name="define_ext"
                                           value="{{ case_info.define.ext }}">
                                </td>
                            </tr>
                            <tr class="">
                                <td rowspan="4" id="server_log_ios"
                                    style="text-align: center;vertical-align: middle;max-width: 80px">
                                    <a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="server">服务端埋点数据<p
                                            style="text-align: left">
                                    </p></a>
                                </td>
                                <td colspan="4" class="hidden"></td>

                            </tr>
                            <tr class="common_type ">
                                <td><a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="regist">注册日志
                                </a>

                                </td>
                                <td><select id="regist_dl" name="regist_dl"
                                            class="form-control">
                                    <option value=""></option>
                                    <option value="1">通过</option>
                                    <option value="0">不通过</option>
                                    <option value="3">忽略</option>
                                    <option value="2">暂不接入</option>
                                </select></td>
                                <td  class="yd_type ">
                                    ——
                                </td>

                                <td class="ext"><input type="text"
                                                                    class="form-control edit_log ext"
                                                                    id="regist_ext"
                                                                    name="regist_ext"
                                                                    value="{{ case_info.regist.ext }}">
                                </td>
                            </tr>
                            <tr class="common_type">
                                <td>
                                    <a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="after_login">
                                        登录完成日志</a></td>
                                <td>
                                    <select id="after_login_dl"
                                            name="after_login_dl"
                                            class="form-control">
                                        <option value=""></option>
                                        <option value="1">通过</option>
                                        <option value="0">不通过</option>
                                        <option value="3">忽略</option>
                                        <option value="2">暂不接入</option>

                                    </select></td>
                                <td  class="yd_type ">
                                    ——
                                </td>

                                <td class="ext"><input type="text"
                                                                    class="form-control edit_log ext"
                                                                    id="after_login_ext"
                                                                    name="after_login_ext"
                                                                    value="{{ case_info.after_login.ext }}">
                                </td>
                            </tr>
                            <tr>
                                <td><a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="recharge">
                                    大陆手游充值到游戏日志</a></td>
                                <td class="common_type"><select id="recharge_dl"
                                                                name="recharge_dl"
                                                                class="form-control">
                                    <option value=""></option>
                                    <option value="1">通过</option>
                                    <option value="0">不通过</option>
                                    <option value="3">忽略</option>
                                    <option value="2">暂不接入</option>

                                </select></td>

                                <td class="yd_type">
                                    <select id="recharge_yd" name="recharge_yd"
                                            class="form-control">
                                        <option value=""></option>
                                        <option value="1">通过</option>
                                        <option value="0">不通过</option>
                                        <option value="3">忽略</option>
                                        <option value="2">暂不接入</option>

                                    </select>
                                </td>

                                <td class="ext"><input type="text"
                                                                    class="form-control edit_log ext"
                                                                    id="recharge_ext"
                                                                    name="recharge_ext"
                                                                    value="{{ case_info.recharge.ext }}">
                                </td>
                            </tr>
                            <tr class="">
                                <td rowspan="8"
                                    style="text-align: center;vertical-align: middle;max-width: 80px">
                                    其他
                                </td>
                                <td colspan="4" class="hidden"></td>
                            </tr>
                            <tr class="recharge_switch" style="">
                                <td><a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="recharge_switch_dl">
                                    充值开关</a></td>
                                <td colspan="2" class="qita_ios"><select
                                        id="recharge_switch_dl"
                                        name="recharge_switch_dl"
                                        class="form-control">
                                    <option value=""></option>
                                    <option value="1">通过</option>
                                    <option value="0">不通过</option>
                                    <option value="3">忽略</option>
                                    <option value="2">暂不接入</option>

                                </select></td>

                                <td class="ext"><input type="text"
                                                                    class="form-control edit_log ext"
                                                                    id="recharge_switch_ext"
                                                                    name="recharge_switch_ext"
                                                                    value="{{ case_info.recharge_switch.ext }}">
                                </td>
                            </tr>
                            <tr class="">
                                <td><a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="change_account">
                                    切换账号</a></td>
                                <td colspan="2" class="qita_ios"><select
                                        id="change_account_dl"
                                        name="change_account_dl"
                                        class="form-control">
                                    <option value=""></option>
                                    <option value="1">通过</option>
                                    <option value="0">不通过</option>
                                    <option value="3">忽略</option>
                                    <option value="2">暂不接入</option>

                                </select></td>

                                <td class="ext"><input type="text"
                                                                    class="form-control edit_log ext"
                                                                    id="change_account_ext"
                                                                    name="change_account_ext"
                                                                    value="{{ case_info.change_account.ext }}">
                                </td>
                            </tr>
                            <tr class="sy">
                                <td><a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="assistance">
                                    小助手回调显示</a></td>
                                <td colspan="2" class="qita_ios"><select
                                        id="assistance_dl"
                                        name="assistance_dl"
                                        class="form-control">
                                    <option value=""></option>
                                    <option value="1">通过</option>
                                    <option value="0">不通过</option>
                                    <option value="3">忽略</option>
                                    <option value="2">暂不接入</option>

                                </select></td>

                                <td class="ext"><input type="text"
                                                                    class="form-control edit_log ext"
                                                                    id="assistance_ext"
                                                                    name="assistance_ext"
                                                                    value="{{ case_info.assistance.ext }}">
                                </td>
                            </tr>
                            <tr class="">
                                <td><a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="share">
                                    游戏内分享</a></td>
                                <td colspan="2" class="qita_ios"><select
                                        id="share_dl"
                                        name="share_dl"
                                        class="form-control">
                                    <option value=""></option>
                                    <option value="1">通过</option>
                                    <option value="0">不通过</option>
                                    <option value="3">忽略</option>
                                    <option value="2">暂不接入</option>

                                </select></td>

                                <td class="ext"><input type="text"
                                                                    class="form-control edit_log ext"
                                                                    id="share_ext"
                                                                    name="share_ext"
                                                                    value="{{ case_info.share.ext }}">
                                </td>
                            </tr>

                            <tr class="common_type">
                                <td><a data-toggle="modal"
                                       data-target="#stepModal"
                                       data-whatever="pkg_name">
                                    渠道ID(非联运IOS统一为10)</a></td>
                                <td colspan="2" class="qita_ios"><select
                                        id="pkg_name_dl"
                                        name="pkg_name_dl"
                                        class="form-control">
                                    <option value=""></option>
                                    <option value="1">通过
                                    </option>
                                    <option value="0">不通过</option>
                                    <option value="3">忽略</option>
                                    <option value="2">暂不接入</option>

                                </select></td>

                                <td class="ext"><input type="text"
                                                                    class="form-control edit_log ext"
                                                                    id="pkg_name_ext"
                                                                    name="pkg_name_ext"
                                                                    value="{{ case_info.pkg_name.ext }}">
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </fieldset>

            </form>
            {# 用例扩展信息 #}
            <div class="form-group">
                <h4 style="margin-top: -20px">本次测试主要问题:</h4>
                <textarea rows="5" id="test_ext" class="edit_log"
                          style="width: 100%;height: auto">{{ game_log.test_ext }}</textarea>
            </div>
            {# 用例编辑按钮 #}
            <div class="form-group">
                <div class="col-sm-3 col-xm-6">
                    <button type="button" onclick="make_edit()"
                            id="update_case"
                            class="btn btn-default">修改用例
                    </button>

                    <button type="button" onclick="make_add()" id="add_case"
                            class="btn btn-default">新增用例
                    </button>
                </div>
                <div class="col-sm-3 col-xm-6">
                    <button type="button" class="btn btn-default"
                            onclick="case_save();">
                        保存用例
                    </button>
                    <button type="button" class="btn btn-default"
                            data-toggle="modal" data-target="#emailModal"
                            data-whatever="">
                        邮件报告
                    </button>
                </div>

                <div class="col-sm-3 col-xm-6">
                    <button id="redis_log" type="button"
                            class="btn btn-default"
                            onclick="search_redis()">
                        SDK日志
                    </button>
                    <input type="text" id="new_user_setting" value="on"
                           hidden>
                    <button id="new_user" type="button"
                            class="btn btn-default"
                            onclick="change_new_user($('#client').val(),$('#new_user_setting').val())">
                        新玩家模式
                    </button>
                </div>
                <div class="col-sm-3 col-xm-6">
                    <a class="btn btn-default"
                       data-toggle="modal"
                       data-whatever="case_del"
                       data-target="#confirm-delete">删除用例</a>

                    <button type="button" class="btn btn-default"
                            onclick="show_logs();">
                        历史用例
                    </button>
                </div>
            </div>
            {# 游戏扩展信息 #}
            <form>
                <div class="form-group">
                    <label for="game_ext"
                           class="control-label">游戏重要信息记录:</label>
                    <textarea name="game_ext" id="game_ext" rows="2">
            {{ game.game_ext }}
            </textarea>

                    <p>
                        <input id="edit" onclick="toggleReadOnly(false);"
                               type="button"
                               value="编辑游戏信息" style="display:none">
                        <input id="reset" onclick="resetContent();"
                               type="button"
                               value="取消编辑信息" style="display:none">
                        <input id="save" onclick="saveData();" type="button"
                               value="保存编辑信息" style="display:none">
                        <span id="save_result"></span>
                    </p>
                </div>
            </form>
        </div>
    </div>

{% endblock %}
